const apiErrorTypes = require('./apiErrorTypes');

/**
 * 自定义Api异常
 */
class ApiError extends Error {
	//构造方法
	constructor(name) {
		super();

		let error = apiErrorTypes.getErrorInfo(name);

		this.name = name;
		this.code = error.code;
		this.message = error.message;
	}
}

module.exports = ApiError;

